package fun.diaoer.service.security;

import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import fun.diaoer.entity.DISysPermission;
import fun.diaoer.entity.DISysRole;
import fun.diaoer.entity.vo.VDISysRole;

public class DiaoerUserDetail implements UserDetails{

	private static final long serialVersionUID = 1L;
	private String username;
    private String password;
    private Set<? extends GrantedAuthority> authorities;
    private List<VDISysRole> roles;
	private List<DISysPermission> perms;
	
	public List<VDISysRole> getRoles() {
		return roles;
	}

	public void setRoles(List<VDISysRole> roles) {
		this.roles = roles;
	}

	public List<DISysPermission> getPerms() {
		return perms;
	}

	public void setPerms(List<DISysPermission> perms) {
		this.perms = perms;
	}

	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		return authorities;
	}

	@Override
	public String getPassword() {
		// TODO Auto-generated method stub
		return this.password;
	}

	@Override
	public String getUsername() {
		// TODO Auto-generated method stub
		return this.username;
	}

	@Override
	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return true;
	}

	public DiaoerUserDetail(List<DISysPermission> perms) {
		super();
		this.perms = perms;
	}

	public DiaoerUserDetail() {
		super();
	}

	public DiaoerUserDetail(String username, String password, Set<? extends GrantedAuthority> authorities) {
		super();
		this.username = username;
		this.password = password;
		this.authorities = authorities;
	}

	public DiaoerUserDetail(String username, String password, Set<? extends GrantedAuthority> authorities,
			List<VDISysRole> roles, List<DISysPermission> perms) {
		super();
		this.username = username;
		this.password = password;
		this.authorities = authorities;
		this.roles = roles;
		this.perms = perms;
	}

	public DiaoerUserDetail(String username, String password, Set<? extends GrantedAuthority> authorities,
			List<VDISysRole> roles) {
		super();
		this.username = username;
		this.password = password;
		this.authorities = authorities;
		this.roles = roles;
	}

}
